﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace Pixer
{
    class Rectangle : Shape
    {
        private Point position;
        /// <summary>
        /// 矩形的左上角位置
        /// </summary>
        public Point Position
        {
            get { return position; }
            set { position = value; }
        }

        private int width;
        /// <summary>
        /// 矩形的宽度
        /// </summary>
        public int Width
        {
            get { return width; }
            set { width = value; }
        }

        private int height;
        /// <summary>
        /// 矩形的高度
        /// </summary>
        public int Height
        {
          get { return height; }
          set { height = value; }
        }


        public override void paint(System.Drawing.Graphics g)
        {
            g.DrawRectangle(Pens.Black, position.X, position.Y, width, height);
        }

        public override void paint(System.Drawing.Bitmap b)
        {
            Line line = new Line();
            line.LineColor = lineColor;
            line.StartPoint = position;
            line.EndPoint = new Point(position.X, position.Y+height);
            line.paint(b);
            line.EndPoint = new Point(position.X+width, position.Y);
            line.paint(b);

            line.StartPoint = new Point(position.X + width, position.Y + height);
            line.EndPoint = new Point(position.X, position.Y + height);
            line.paint(b);
            line.EndPoint = new Point(position.X + width, position.Y);
            line.paint(b);

        }
    }
}
